<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Ads extends Model
{
    protected $table = 'ads';
    public $timestamps = false;
    protected $guarded = [];
    
    public static function getAdsByPosition($position, $limit=6)
    {
        $time = date('Y-m-d');
        $data = self::where('ads_position', $position)
                ->where('ads_status', 1)
                ->where('ads_endtime', '>=', $time)
                ->limit($limit)
                ->get();
        
        return $data;
    }
}
